/*!
 * FileName: hdu-3018.cpp
 * This Problem is on hdu. The ID of the problem is 3018. 
 * Copyright(c) 2019 Shu_Yu_Mo
 * MIT Licensed
 * Luogu: https://www.luogu.org/space/show?uid=44615
 * Github: https://github.com/oldsuold/
 * Gitee: https://gitee.com/Shu_Yu_Mo/
 * These words were created by an amazing tool written by Shu_Yu_Mo.
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstring>
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#define inf 0x7fffffff
using namespace std;
const int _N = 100010;
const int _M = 200010;
inline int read()
{
    char c = getchar(); int sign = 1; int x = 0;
    while(c > '9' || c < '0') { if(c=='-')sign = -1; c = getchar(); } 
    while(c <= '9' && c >= '0') { x *= 10; x += c - '0'; c = getchar(); }
    return x * sign;
}
struct edgeType{
	int vis[_N];
	int ind[_N];
//	int head[_N];
//	struct _edge{
//		int node;
//		int nxt;
//	}edge[_M];
//	int tot;
	void init()  { /*tot = 0;*/ memset(vis, 0, sizeof(vis)); memset(ind, 0, sizeof(ind));/* memset(head, 0, sizeof(head)); */}
//	void add(int u, int v)
//	{
//		ind[v] ++;//ind[u] ++;
//		edge[++tot].nxt = head[u];
//		edge[tot].node = v;
//		head[u] = tot;
//	}
}E;
//int nowRoot;
//void dfs(int k)
//{
//	E.vis[k] = nowRoot;
//	for(register int i = E.head[k];i != 0;i = E.edge[i].nxt)
//	{
//		int & node = E.edge[i].node;
//		if(E.vis[node]) continue;
//		dfs(node);
//	}
//}

int f[_N];
void init(int n) { for(register int i = 1;i <= n;i++)f[i] = i; }
int find(int x){ return f[x] == x ? x : f[x] = find(f[x]); }
void marge(int x, int y) { if(find(x) == find(y)) return ; f[find(x)] = find(y); }
bool ask(int x, int y) { return find(x) == find(y); }

int TotAns[_N];
int doit()
{
//	puts("# At new case");
	E.init();
	memset(TotAns, -1, sizeof(TotAns));
	int n, m;
	int input = scanf("%d%d", &n, &m);
	init(n);
	if(input != 2) return 0;
	for(register int i = 1;i <= m;i++)
	{
		int a = read(), b = read();
		marge(a, b);
		E.ind[a] ++;
		E.ind[b] ++;
//		E.add(a, b);
//		E.add(b, a);
	}
	for(register int i = 1;i <= n;i++)
		E.vis[i] = find(i);
//	for(register int i = 1; i <= n;i++)
//		if(!E.vis[i])
//			nowRoot = i, dfs(i);
//	
//	cout<<endl;for(register int i = 1;i <= n;i++)	cout<<i <<" "<<E.ind[i]<<endl;cout<<endl;
//	
//	cout<<endl;for(register int i = 1;i <= n;i++)	cout<<i <<" "<<E.vis[i]<<endl;cout<<endl;
//	
	for(register int i = 1;i <= n;i++)
	{
		if(TotAns[E.vis[i]] == -1) TotAns[E.vis[i]] = 0;
		if(E.ind[i] % 2 == 1)
		{
//			printf("#%d\n", i);
			TotAns[E.vis[i]]++;
		}
	}
		
//	cout<<endl;for(register int i = 1;i <= n;i++)	cout<<i <<" "<<TotAns[i]<<endl;cout<<endl;
	int ans = 0;
	for(register int i = 1;i <= n;i++)
	{
		if(E.ind[i] == 0 || TotAns[i] == -1) continue;
		if(TotAns[i] == 0) ans ++;
		else  ans += (TotAns[i] >> 1);
	}
	printf("%d\n", ans);
    return -1;
}
int main()
{
//	freopen("test.in.txt", "r", stdin);
	while(true)
	{
		int k = doit();
		if(k == 0) break;
	}
	return 0;
}
